﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<web_uchet.Views.Shared.TemplateClasses.NumericTemplateViewData>" %>

<label for="<%= Model.ID %>"><%=Model.LabelText %></label>
<%= Html.TextBox( Model.Name,
        String.IsNullOrEmpty(Model.Value)?string.Empty:Model.Value, 
        new { @class = "input-box", id = Model.ID })%>

<%= Html.ValidationMessage(Model.Name, "*") %>

<script type="text/javascript">
    jQuery.noConflict(); 
     if (!jQuery.validator.methods.regex)jQuery.validator.addMethod("numeric", function(value, element) { 
    var check = false;
    var re = new RegExp("^-?[0-9\.,]+$");
    return this.optional(element) || re.test(value);
    }, "Проверьте поле ввода.");

jQuery(document).ready(function() {
    jQuery("#<%= Model.FormID %>").validate();

    jQuery("#<%= Model.ID %>").rules("add", {
        numeric: true,
	    messages: {
	        numeric: "Введите число"
	    }
    });  
});
</script>